import request from '../lib/index'

interface QueryInfo {
  pageNum: number,
  pageSize: number
}
interface AddTypeForm {
  type_name: string
}
interface DeleteTypeForm {
  id: string
}
interface EditTypeForm {
  id: string,
  type_name: string
}
// 获取类型列表
const getTypes = (data: QueryInfo) => {
  return request({
    url: '/type/typeInfo',
    method: 'post',
    data
  })
}
// 新增类型
const addType = (data: AddTypeForm) => {
  return request({
    url: '/type/add',
    method: 'post',
    data
  })
}
// 删除类型
const deleteType = (data: DeleteTypeForm) => {
  return request({
    url: '/type/del',
    method: 'post',
    data
  })
}
// 修改类型
const editType = (data: EditTypeForm) => {
  return request({
    url: '/type/edit',
    method: 'post',
    data
  })
}
export { getTypes, addType, deleteType, editType }